/*
 * @Author: taoyuqing
 * @Date: 2022-12-28 23:24:20
 * @Description: 
 */
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:spree/pages/search/search_options.dart';
import 'package:spree/utils/utils.dart';
import 'package:spree/widgets/common_container.dart';

import '../../widgets/gameGroup/grid_imgs.dart';
import '../drawerContent/drawer_select_menu.dart';

class GameSearchPage extends StatefulWidget {
  GameSearchPage({Key? key}) : super(key: key);

  @override
  State<GameSearchPage> createState() => _GameSearchPageState();
}

class _GameSearchPageState extends State<GameSearchPage> {
  final List<Map> _games = [
    {'img': 'images/game7.png', 'alias': 'Crash'},
    {'img': 'images/game8.png', 'alias': 'Crash'},
    {'img': 'images/game9.png', 'alias': 'Mines'},
    {'img': 'images/game10.png', 'alias': 'Double'},
    {'img': 'images/game11.png', 'alias': 'Double'},
    {'img': 'images/game22.png', 'alias': 'Double'},
    {'img': 'images/game23.png', 'alias': 'Double'},
    {'img': 'images/game24.png', 'alias': 'Double'},
    {'img': 'images/game26.png', 'alias': 'Double'},
    {'img': 'images/game25.png', 'alias': 'Double'},
    {'img': 'images/game28.png', 'alias': 'Double'},
  ];
  final FocusNode _focusNode = FocusNode();
  final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      key: _scaffoldKey,
      appBar: AppBar(
        title: TextField(
          focusNode: _focusNode,
          style: TextStyle(color: Colors.white),
          cursorColor: Colors.white,
          decoration: InputDecoration(
              hintText: '请输入搜索内容',
              border: InputBorder.none,
              hintStyle: TextStyle(
                color: Color.fromRGBO(255, 255, 255, 0.7),
              )),
        ),
      ),
      endDrawer: Drawer(child: SearchOptions()),
      body: GestureDetector(
        onTap: () {
          _focusNode.unfocus();
        },
        child: CommonContainer(
          child: ListView(
            padding: EdgeInsets.only(top: 20),
            children: [
              GridImgs(
                games: _games,
                ontap: (value) {
                  Navigator.pushNamed(context, value['alias']);
                },
              )
            ],
          ),
        ),
      ),
    );
  }
}
